/* trw.t  tr_hist Inventory Transaction Write Trigger                         */
/*Copyright 1986-2003 QAD Inc., Carpinteria, CA, USA.                         */
/*All rights reserved worldwide.  This is an unpublished work.                */
/* $Revision: 1.3.3.2 $                                                           */
/*V8:ConvertMode=NoConvert                                                    */
/******************************************************************************/
/* Revision: 1.1        BY: Jean Miller          DATE: 06/06/02  ECO: *P07T*  */
/* Revision: 1.2        BY: Jean Miller          DATE: 06/13/02  ECO: *P082*  */
/* Revision: 1.3        BY: Jean Miller          DATE: 08/01/02  ECO: *P0CL*  */
/* $Revision: 1.3.3.2 $     BY: Jean Miller          DATE: 09/09/03  ECO: *P10C*  */
/******************************************************************************/

TRIGGER PROCEDURE FOR WRITE OF tr_hist OLD BUFFER old_tr_hist.

{mfdeclre.i}

define new shared work-table wf_old_tr_hist like tr_hist.

/* Removed logic, data now captured differently */

HK:
do:
    if can-find(first dt_mstr where dt_table = "tr_hist" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(tr_hist), input "tr_hist").

    if not can-find ( first dt_mstr where dt_table = "tr_hist" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_tr_hist ) then do:
        create wf_old_tr_hist.
        if recid(wf_old_tr_hist)= -1 then .
    end.
    
    buffer-copy old_tr_hist to wf_old_tr_hist no-error.

    for each dt_mstr no-lock where dt_table = "tr_hist" and dt_type = "MOD" :
    
        case dt_field :

            when "tr_part" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_part, input tr_hist.tr_part,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_date), input string(tr_hist.tr_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_per_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_per_date), input string(tr_hist.tr_per_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_type, input tr_hist.tr_type,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_loc, input tr_hist.tr_loc,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_loc_begin" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_loc_begin), input string(tr_hist.tr_loc_begin),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_begin_qoh" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_begin_qoh), input string(tr_hist.tr_begin_qoh),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_qty_req" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_qty_req), input string(tr_hist.tr_qty_req),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_qty_chg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_qty_chg), input string(tr_hist.tr_qty_chg),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_qty_short" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_qty_short), input string(tr_hist.tr_qty_short),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_um" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_um, input tr_hist.tr_um,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_last_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_last_date), input string(tr_hist.tr_last_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_nbr, input tr_hist.tr_nbr,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_so_job" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_so_job, input tr_hist.tr_so_job,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ship_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ship_type, input tr_hist.tr_ship_type,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_addr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_addr, input tr_hist.tr_addr,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_rmks" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_rmks, input tr_hist.tr_rmks,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xdr_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xdr_acct, input tr_hist.tr_xdr_acct,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xcr_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xcr_acct, input tr_hist.tr_xcr_acct,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_mtl_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_mtl_std), input string(tr_hist.tr_mtl_std),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_lbr_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_lbr_std), input string(tr_hist.tr_lbr_std),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_bdn_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_bdn_std), input string(tr_hist.tr_bdn_std),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_price" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_price), input string(tr_hist.tr_price),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_trnbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_trnbr), input string(tr_hist.tr_trnbr),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_gl_amt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_gl_amt), input string(tr_hist.tr_gl_amt),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xdr_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xdr_cc, input tr_hist.tr_xdr_cc,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xcr_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xcr_cc, input tr_hist.tr_xcr_cc,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_lot" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_lot, input tr_hist.tr_lot,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_sub_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_sub_std), input string(tr_hist.tr_sub_std),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_gl_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_gl_date), input string(tr_hist.tr_gl_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_qty_loc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_qty_loc), input string(tr_hist.tr_qty_loc),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_userid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_userid, input tr_hist.tr_userid,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_serial" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_serial, input tr_hist.tr_serial,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_effdate" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_effdate), input string(tr_hist.tr_effdate),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_prod_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_prod_line, input tr_hist.tr_prod_line,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xslspsn1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xslspsn1, input tr_hist.tr_xslspsn1,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xslspsn2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xslspsn2, input tr_hist.tr_xslspsn2,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xcr_proj" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xcr_proj, input tr_hist.tr_xcr_proj,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xdr_proj" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xdr_proj, input tr_hist.tr_xdr_proj,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_line), input string(tr_hist.tr_line),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_user1, input tr_hist.tr_user1,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_user2, input tr_hist.tr_user2,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_curr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_curr, input tr_hist.tr_curr,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ex_rate" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_ex_rate), input string(tr_hist.tr_ex_rate),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_rev" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_rev, input tr_hist.tr_rev,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_time" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_time), input string(tr_hist.tr_time),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ovh_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_ovh_std), input string(tr_hist.tr_ovh_std),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_site, input tr_hist.tr_site,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_status" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_status, input tr_hist.tr_status,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_grade" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_grade, input tr_hist.tr_grade,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_expire" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_expire), input string(tr_hist.tr_expire),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_assay" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_assay), input string(tr_hist.tr_assay),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_xgl_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_xgl_ref, input tr_hist.tr_xgl_ref,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr01, input tr_hist.tr__chr01,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr02, input tr_hist.tr__chr02,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr03, input tr_hist.tr__chr03,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr04, input tr_hist.tr__chr04,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr05, input tr_hist.tr__chr05,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr06, input tr_hist.tr__chr06,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr07, input tr_hist.tr__chr07,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr08" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr08, input tr_hist.tr__chr08,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr09" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr09, input tr_hist.tr__chr09,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr10" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr10, input tr_hist.tr__chr10,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr11" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr11, input tr_hist.tr__chr11,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr12" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr12, input tr_hist.tr__chr12,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr13" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr13, input tr_hist.tr__chr13,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr14" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr14, input tr_hist.tr__chr14,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__chr15" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr__chr15, input tr_hist.tr__chr15,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dte01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dte01), input string(tr_hist.tr__dte01),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dte02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dte02), input string(tr_hist.tr__dte02),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dte03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dte03), input string(tr_hist.tr__dte03),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dte04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dte04), input string(tr_hist.tr__dte04),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dte05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dte05), input string(tr_hist.tr__dte05),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dec01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dec01), input string(tr_hist.tr__dec01),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dec02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dec02), input string(tr_hist.tr__dec02),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dec03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dec03), input string(tr_hist.tr__dec03),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dec04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dec04), input string(tr_hist.tr__dec04),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__dec05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__dec05), input string(tr_hist.tr__dec05),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__log01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__log01), input string(tr_hist.tr__log01),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr__log02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr__log02), input string(tr_hist.tr__log02),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ref" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ref, input tr_hist.tr_ref,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_msg" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_msg), input string(tr_hist.tr_msg),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_program" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_program, input tr_hist.tr_program,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ord_rev" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_ord_rev), input string(tr_hist.tr_ord_rev),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ref_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ref_site, input tr_hist.tr_ref_site,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_rsn_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_rsn_code, input tr_hist.tr_rsn_code,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_vend_lot" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_vend_lot, input tr_hist.tr_vend_lot,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_vend_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_vend_date), input string(tr_hist.tr_vend_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_daycode" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_daycode, input tr_hist.tr_daycode,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_for" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_for, input tr_hist.tr_for,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_slspsn[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_slspsn[1], input tr_hist.tr_slspsn[1],
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_fsm_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_fsm_type, input tr_hist.tr_fsm_type,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_upd_isb" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_upd_isb), input string(tr_hist.tr_upd_isb),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_auto_install" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_auto_install), input string(tr_hist.tr_auto_install),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ca_int_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ca_int_type, input tr_hist.tr_ca_int_type,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_covered_amt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_covered_amt), input string(tr_hist.tr_covered_amt),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_fcg_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_fcg_code, input tr_hist.tr_fcg_code,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_batch" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_batch, input tr_hist.tr_batch,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_fsc_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_fsc_code, input tr_hist.tr_fsc_code,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_sa_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_sa_nbr, input tr_hist.tr_sa_nbr,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_sv_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_sv_code, input tr_hist.tr_sv_code,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_eng_area" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_eng_area, input tr_hist.tr_eng_area,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_sys_prod" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_sys_prod, input tr_hist.tr_sys_prod,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_svc_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_svc_type, input tr_hist.tr_svc_type,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ca_opn_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_ca_opn_date), input string(tr_hist.tr_ca_opn_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_cprice" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_cprice), input string(tr_hist.tr_cprice),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_eng_code" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_eng_code, input tr_hist.tr_eng_code,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_wod_op" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_wod_op), input string(tr_hist.tr_wod_op),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_enduser" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_enduser, input tr_hist.tr_enduser,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ship_inv_mov" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ship_inv_mov, input tr_hist.tr_ship_inv_mov,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ship_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_ship_date), input string(tr_hist.tr_ship_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ship_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ship_id, input tr_hist.tr_ship_id,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ex_rate2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_ex_rate2), input string(tr_hist.tr_ex_rate2),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_ex_ratetype" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_tr_hist.tr_ex_ratetype, input tr_hist.tr_ex_ratetype,
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_exru_seq" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_exru_seq), input string(tr_hist.tr_exru_seq),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_promise_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_promise_date), input string(tr_hist.tr_promise_date),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "tr_fldchg_cmtindx" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_tr_hist.tr_fldchg_cmtindx), input string(tr_hist.tr_fldchg_cmtindx),
                    input recid(tr_hist), input tr_hist.tr_trnbr, input "", input "", input "",
                    input "", input "", input "", input "").

        end.

    end.
end.

{hkdttrans.i}
